package com.hzx.clients;

import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 服务降级
 */
@Component
public class TimeClientServiceFallbackFactory implements FallbackFactory {
    @Override
    public TimeClient create(Throwable throwable) {
        return new TimeClient() {
            @Override
            public Date getTime() {
                Date date = new Date();
                date.setHours(date.getHours() + 8);
                return date;
            }
        };
    }
}
